
<script setup>
import getStatusHeight from '/utils/getStatusHeight.js';
import { onLoad } from "@dcloudio/uni-app"
import * as Api from '/api/papers';
import * as Api1 from '/api/questions';
import * as AudioApi from '/api/audio';
const {statusBarHeight,topBarHeight } = getStatusHeight()
import {ref, watch, computed} from 'vue'

import { useCommonStore } from '/stores/common'
const common = useCommonStore()
let show = ref(false)
let show1 = ref(false)
function secondsToMinutesSeconds(seconds) {
  const minutes = Math.floor(seconds / 60); // 计算完整的分钟数
  const remainingSeconds = seconds % 60; // 计算剩余的秒数
  return `${towNum(minutes)}:${towNum(remainingSeconds)}`;
}
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
// innerAudioContext.src = "http://ws.stream.qqmusic.qq.com/C400001WYpTf3HTYrK.m4a?guid=397896146&vkey=596AE1EE9342FF0392CD934E735B6F01230F3DB3C52BCDC97A7D5843645EC88E534393B90DEEA5D569F2A47D5FCA07EF44CDAFD3BBDED4C5__v2b94c6e9&uin=&fromtag=120032&src=C400003Kdzcy1TuJCp.m4a"
innerAudioContext.onPlay(() => {
  console.log('开始播放');
});
innerAudioContext.onTimeUpdate(() => {
  timec.value= Math.floor(innerAudioContext.currentTime)
  timeb.value= secondsToMinutesSeconds(Math.floor(innerAudioContext.currentTime))
})
const sliderChange = (e) => {

  innerAudioContext.pause();

  innerAudioContext.seek(e.detail.value)
  innerAudioContext.play();


}
function generateUUID() {
  // 1. 浏览器环境（H5）
  if (typeof window !== 'undefined' && window.crypto?.randomUUID) {
    return crypto.randomUUID();
  }

  // 2. 小程序/App环境（需兼容处理）
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    const r = Math.random() * 16 | 0;
    return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
  });
}
function towNum(num)
{
  if (num >= 10) {
    return num;
  } else {
    return '0' + num;
  }
}

let time = ref(0)
let timeb = ref(0)
let timec = ref(0)
innerAudioContext.onCanplay(() => {
  let intervalID = setInterval(() => {
    if (innerAudioContext.duration !== 0) {
      clearInterval(intervalID); // 清除定时器
      time.value=secondsToMinutesSeconds(Math.floor(innerAudioContext.duration))
      timeb.value=secondsToMinutesSeconds(Math.floor(innerAudioContext.currentTime))
    }
  }, 500);
  console.log(innerAudioContext.duration)
})
const status = ref(true)
function start() { //点击播放
  console.log("点击播放")
  if(!status.value) {
    innerAudioContext.play();
    status.value = true;
  }
}

function stop() { //点击暂停
  console.log("点击暂停")
  if(status.value) {
    innerAudioContext.pause();
    status.value = false;
  }
}
let i = ref(0)
const p = [1.0,1.25,1.5,2.0,0.5,0.8]
let pi = ref(1.0)
function playbackRate(){
  i.value = i.value + 1
  innerAudioContext.playbackRate = p[Math.floor(i.value%6)];
  pi.value = p[Math.floor(i.value%6)]
}
function closeShow(){
  show.value = false
}
let questionCount = ref(0)
let  questionType= ref(0)
let questionList = ref([])
let questionList1 = ref()
let questionList2 = ref()
let questionList3 = ref()
let questionList4 = ref()
let questionList5 = ref()
let ans = ref(["",["","","","","","","","","","","","","","","","","","","","","","","","",""],
  ["","","","","","","","","",""],["","","","","","","","","",""],["","","","",""],["","","","",""],""])
let right_ans = ref(["",["","","","","","","","","","","","","","","","","","","","","","","","",""],
  ["","","","","","","","","",""],["","","","","","","","","",""],["","","","",""],["","","","",""],""])
let title = ref('')
let id = ref()
let typeIds = ref([])
onLoad(async (e)=>{
  // for (let j = 0; j < 6; j++) {
  //   let res =await Api.getTypeTitleList(e.tid)
  //   res.data.forEach(x => {
  //     if (x.title === e.title){
  //       typeIds.value.push(x.id)
  //     }
  //   })
  // }
  title.value = e.title
  let res = await Api.getfindPaperList(e.tid)
  console.log(res.data)
  ans.value[1] = res.data[0].stu_answer.map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else return x
  })
  ans.value[2] = res.data[1].stu_answer.map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  ans.value[3] = res.data[2].stu_answer.map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  ans.value[4] = res.data[3].stu_answer.map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  ans.value[5] = res.data[4].stu_answer.map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  ans.value[0] = res.data[5].stu_answer[0]
  ans.value[6] = res.data[6].stu_answer[0]
  console.log(ans.value)
  right_ans.value[1] = res.data[0].right_answer.split("").map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  right_ans.value[2] = res.data[1].right_answer.split("").map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  right_ans.value[3] = res.data[2].right_answer.split("").map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  right_ans.value[4] = res.data[3].right_answer.split("").map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  right_ans.value[5] = res.data[4].right_answer.split("").map(x => {
    if (x === "A") return 0
    else if (x === "B") return 1
    else if (x === "C") return 2
    else if (x === "D") return 3
    else if (x === "E") return 4
    else if (x === "F") return 5
    else if (x === "G") return 6
    else if (x === "H") return 7
    else if (x === "I") return 8
    else if (x === "J") return 9
    else if (x === "K") return 10
    else if (x === "L") return 11
    else if (x === "M") return 12
    else if (x === "N") return 13
    else if (x === "0") return 14
    else return x      })
  right_ans.value[0] = res.data[5].right_answer
  right_ans.value[6] = res.data[6].right_answer
  let res1 =await Api1.getQuestions(res.data[5].question_id)
  questionList.value.push(res1.data)
  for (let j = 0; j < 5; j++) {
    let res1 = await Api1.getQuestions(res.data[j].question_id)
    questionList.value.push(res1.data)
  }
  let res2 =await Api1.getQuestions(res.data[6].question_id)
  questionList.value.push(res2.data)
  questionList1.value = JSON.parse(questionList.value[1].opt)
  questionList2.value = JSON.parse(questionList.value[2].opt)
  questionList3.value = JSON.parse(questionList.value[3].opt)
  questionList4.value = JSON.parse(questionList.value[4].opt)
  questionList5.value = JSON.parse(questionList.value[5].opt)
  console.log(questionList.value)
})
function goBack(){
  uni.navigateBack();
}
let Wstrings = ref('')
let HearingActive = computed(() => {
  return questionCount.value-1 >=0 ?  questionCount.value-1 : 0
})
function last(){
  console.log(questionCount.value)
  console.log(questionType.value)
  if(questionType.value == 3) {
    questionCount.value = 35
    questionType.value = 2
  }else if(questionType.value == 4){
    questionCount.value = 45
    questionType.value = 3
  }else if(questionCount.value == 1){
    questionCount.value = 0
    questionType.value = 0
  }else if(questionType.value == 5){
    questionCount.value = 50
    questionType.value = 4
  }else if (questionType.value == 2){
    questionCount.value = 25
    questionType.value = 1
  }else if (questionType.value == 6){
    questionCount.value = 55
    questionType.value = 5
  } else if (questionCount.value>0){
    questionCount.value = questionCount.value - 1
    console.log(questionCount.value)
  }
  if (questionCount.value == 0 || questionCount.value > 25) stop()
  else start()
}
function next(){
  if(questionType.value == 2){
    questionCount.value = 45
  }else if (questionType.value == 3){
    questionCount.value = 50
  } else if (questionType.value == 4){
    questionCount.value = 55
  } else if (questionCount.value < 57) questionCount.value = questionCount.value + 1

  if (questionCount.value > 26) stop()

  if (questionCount.value > 0 && questionCount.value < 26){
    questionType.value = 1
  }else if(questionCount.value > 25 && questionCount.value < 36){
    questionType.value = 2
  }else if (questionCount.value > 35 && questionCount.value < 46){
    questionType.value = 3
  }else if (questionCount.value > 45 && questionCount.value < 51){
    questionType.value = 4
  }else if (questionCount.value > 50 && questionCount.value < 56){
    questionType.value = 5
  }else if (questionCount.value > 55){
    questionType.value = 6
  }
}
watch(questionCount,async (newData, oldData) => {
  if (newData > 0 && newData < 2) {
    let title1 = await AudioApi.getAudio(title.value)
    innerAudioContext.src = title1.data[0].audio
  }

})
const ss = ['A','B','C','D','E','F','G','H','I','J','K']

function selected1(indx,idx){
  ans.value[1][indx] = idx
}
function selected2(indx,idx){
  ans.value[2][indx] = idx
}
function selected3(indx,idx){
  ans.value[3][indx] = idx
}

function selected4(indx,idx){
  ans.value[4][indx] = idx
}
function selected5(indx,idx){
  ans.value[5][indx] = idx
}
const uuid = generateUUID()
function getToday() {
  const today = new Date();
  const year = today.getFullYear();
  const month = String(today.getMonth() + 1).padStart(2, '0');
  const day = String(today.getDate()).padStart(2, '0');

  return `${year}-${month}-${day}`;
}
async function submission() {
  uni.setStorageSync('time',  Number(uni.getStorageSync('time'))+common.time);
  if (uni.getStorageSync('qd')){
    if (uni.getStorageSync("qd") !== getToday()){
      uni.setStorageSync('qd1',Number(uni.getStorageSync('qd1'))+1)
      uni.setStorageSync('qd',getToday())
    }
  }else {
    uni.setStorageSync('qd1',1)
    uni.setStorageSync('qd',getToday())
  }
  common.fig = true
  common.score = 0
  common.sp = []
  console.log(typeIds.value)
  let res1 = await Api.submission({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "questionId": typeIds.value[1],
    "answer": ans.value[1].map(x => {
      if (x === 0) return "A"
      else if (x === 1) return "B"
      else if (x === 2) return "C"
      else if (x === 3) return "D"
      else return x
    }),
    "duringTime": Date.now(),
    "homeworkId": 0,
  })
  common.score += res1.data.score
  common.sp.push(...res1.data.result)

  let res2 = await Api.submission({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "questionId": typeIds.value[2],
    "answer": ans.value[2].map(x => {
      if (x === 0) return "A"
      else if (x === 1) return "B"
      else if (x === 2) return "C"
      else if (x === 3) return "D"
      else if (x === 4) return "E"
      else if (x === 5) return "F"
      else if (x === 6) return "G"
      else if (x === 7) return "H"
      else if (x === 8) return "I"
      else if (x === 9) return "J"
      else if (x === 10) return "K"
      else if (x === 11) return "L"
      else if (x === 12) return "M"
      else if (x === 13) return "N"
      else if (x === 14) return "0"
      else return x      }),
    "duringTime": Date.now(),
    "homeworkId": 0,
  })
  common.score += res2.data.score
  common.sp.push(...res2.data.result)

  let res3 = await Api.submission({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "questionId": typeIds.value[3],
    "answer": ans.value[3].map(x => {
      if (x === 0) return "A"
      else if (x === 1) return "B"
      else if (x === 2) return "C"
      else if (x === 3) return "D"
      else if (x === 4) return "E"
      else if (x === 5) return "F"
      else if (x === 6) return "G"
      else if (x === 7) return "H"
      else if (x === 8) return "I"
      else if (x === 9) return "J"
      else if (x === 10) return "K"
      else if (x === 11) return "L"
      else if (x === 12) return "M"
      else if (x === 13) return "N"
      else if (x === 14) return "0"
      else return x
    }),
    "duringTime": Date.now(),
    "homeworkId": 0,
  })
  common.score += res3.data.score
  common.sp.push(...res3.data.result)

  let res4 = await Api.submission({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "questionId": typeIds.value[4],
    "answer": ans.value[4].map(x => {
      if (x === 0) return "A"
      else if (x === 1) return "B"
      else if (x === 2) return "C"
      else if (x === 3) return "D"
      else if (x === 4) return "E"
      else if (x === 5) return "F"
      else if (x === 6) return "G"
      else if (x === 7) return "H"
      else if (x === 8) return "I"
      else if (x === 9) return "J"
      else if (x === 10) return "K"
      else if (x === 11) return "L"
      else if (x === 12) return "M"
      else if (x === 13) return "N"
      else if (x === 14) return "0"
      else return x
    }),
    "duringTime": Date.now(),
    "homeworkId": 0,
  })
  common.score += res4.data.score
  common.sp.push(...res4.data.result)
  let res5 = await Api.submission({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "questionId": typeIds.value[5],
    "answer": ans.value[5].map(x => {
      if (x === 0) return "A"
      else if (x === 1) return "B"
      else if (x === 2) return "C"
      else if (x === 3) return "D"
      else if (x === 4) return "E"
      else if (x === 5) return "F"
      else if (x === 6) return "G"
      else if (x === 7) return "H"
      else if (x === 8) return "I"
      else if (x === 9) return "J"
      else if (x === 10) return "K"
      else if (x === 11) return "L"
      else if (x === 12) return "M"
      else if (x === 13) return "N"
      else if (x === 14) return "0"
      else return x
    }),
    "duringTime": Date.now(),
    "homeworkId": 0,
  })
  common.score += res5.data.score
  common.sp.push(...res5.data.result)

  let res0 = await Api.submissionW1(questionList.value[0].content+' '+ans.value[0])
  // common.score += res0.message

  let res6 = await Api.submissionW2(questionList.value[6].content+' '+ans.value[6])
  console.log(common.score)
  // common.score += res6.message
  await Api.submitScore({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "qid": typeIds.value[0],
    "answer": ans.value[0],
    "score": ans.value[0] === "" ? 0 :res0.message.slice(1,3),
    "homeworkId": 0,
  })
  common.zw = ans.value[0] === "" ? 0 :res0.message.slice(1,3)
  await Api.submitScore({
    "title": title.value,
    "bankId": uuid,
    "stuId": uni.getStorageSync('userId').split(" ")[0],
    "type": 2,
    "qid": typeIds.value[6],
    "answer": ans.value[6],
    "score": ans.value[6] === "" ? 0 :res6.message.slice(1,3),
    "homeworkId": 0,
  })
  common.fy = ans.value[6] === "" ? 0 :res6.message.slice(1,3)
  uni.redirectTo({
    url: '/pages/result/result'
  })

}
</script>

<template>
  <view :style="{'padding-top': statusBarHeight+'px',height: +topBarHeight+'px'}" style="background-color: white;display: flex;align-items: center;justify-content: flex-start;gap: 200rpx;padding-left: 30rpx">
    <van-icon @click="goBack" name="arrow-left" size="50rpx" /><view style="display: flex;align-items: center;gap: 10rpx">
<!--    <van-icon name="clock-o" size="40rpx"/>-->
<!--    <van-count-down :time="1000*125*60" />-->
  </view>
  </view>
  <view style="display: flex;align-items: center;justify-content: space-between;padding: 10rpx 30rpx">
    <view style="display: flex;align-items: center;gap: 10rpx">
      <van-tag size="medium" v-if="questionType==0" type="success">写作</van-tag>
      <van-tag size="medium" v-if="questionType==1"  type="success">听力</van-tag>
      <van-tag size="medium" v-if="questionType==2"  type="success">选词填空</van-tag>
      <van-tag size="medium" v-if="questionType==3"  type="success">段落匹配</van-tag>
      <van-tag size="medium" v-if="questionType==4"  type="success">仔细阅读</van-tag>
      <van-tag size="medium" v-if="questionType==5"  type="success">仔细阅读</van-tag>
      <van-tag size="medium" v-if="questionType==6"  type="success">翻译</van-tag>
      <view style="font-size: 28rpx;color: #3F536E;opacity: 0.6">{{title}}</view>
    </view>
    <view style="font-size: 28rpx;color: #3F536E;opacity: 0.6"><text style="font-size: 32rpx;color: #0AD192"></text></view>
  </view>
  <view v-show="questionCount > 0 && questionCount < 26">
    <view style="background-color: #F6F8FC;height: 180rpx;width: 680rpx;margin: 20rpx auto;border-radius: 20rpx;display: flex;align-items: center;justify-content: center">
      <van-icon v-if="!status" @click="start" name="play-circle" color="#0AD192" size="40"/>
      <van-icon v-else name="pause-circle" color="#0AD192" size="40" @click="stop"/>
      <view style="display: flex;flex-direction: column;width: 400rpx">
        <slider :value="timec" :min='0' :max='innerAudioContext.duration.toFixed(0)' @change="sliderChange" :step="0.1" block-color="#0AD192" block-size="14" />
        <view style="font-size: 20rpx;color: #bcbcbc;margin: 0 36rpx">{{timeb ? timeb : '00:00'}}/{{time ? time : '00:00'}}</view>
      </view>
      <view @click="playbackRate()">
        <van-tag size="medium" type="success">{{pi}}x</van-tag>
      </view>

    </view>
    <scroll-view scroll-y style="height: calc(100vh - 540rpx);">
      <van-tabs :active="HearingActive" swipeable color = '#0AD192'>
        <van-tab v-for="(item,index) in questionList1" :title="'题目'+(index+1)">
          <scroll-view scroll-y style="width: 700rpx;height: 660rpx;background-color: #F6F8FC;padding: 20rpx">
            <view @click="selected1(index,idx)" :class="{'select': idx.toString() == right_ans[1][index],'selecterror': idx.toString() == ans[1][index] && right_ans[1][index] != ans[1][index] }" v-for="(it,idx) in item.split(',')" style="background-color: white;padding: 40rpx;margin: 35rpx 20rpx;border-radius: 10rpx;min-height: 80rpx;line-height: 80rpx">
              {{it}}
            </view>


          </scroll-view>

        </van-tab>
      </van-tabs>
    </scroll-view>
  </view>


  <view v-show="questionCount > 25 && questionCount < 36" style="height: calc(100vh - 285rpx);background-color: #F6F8FC">
    <scroll-view scroll-y :class="{'cont':!show}" style="height: 480rpx;">
      <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">
        {{questionList[2].content}}
      </view>

    </scroll-view>

  </view>
  <van-popup
      v-show="questionCount > 25 && questionCount < 41"
      closeable
      :overlay="false"
      :show="show"
      position="bottom"
      round
      custom-style="height: 660rpx;"
      @close="closeShow"
  >
    <van-tabs swipeable color = '#0AD192'>
      <van-tab  v-for="(item,index) in questionList2" :title="index+1">
        <scroll-view scroll-y style="width: 700rpx;height: 520rpx;background-color: #F6F8FC;padding: 20rpx;">
          <view style="display: flex;flex-wrap: wrap;gap: 20rpx">
            <view  :class="{'select': idx.toString() == ans[2][index] }" @click="selected2(index,idx)" v-for="(item1,idx) in questionList2" style="width: 340rpx;height: 100rpx;background-color: white;font-size: 26rpx;line-height: 100rpx;text-align: center;border-radius: 10rpx">
              {{item1}}
            </view>
          </view>

        </scroll-view>

      </van-tab>
    </van-tabs>
    <!--    <van-icon name="arrow-down" />-->
  </van-popup>

  <view v-show="questionType == 3" style="height: calc(100vh - 285rpx);background-color: #F6F8FC">
    <scroll-view scroll-y :class="{'cont':!show}" style="height: 480rpx;">
      <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">
        {{questionList[3].content}}
      </view>

    </scroll-view>

  </view>
  <van-popup
      v-show="questionType == 3"
      closeable
      :overlay="false"
      :show="show"
      position="bottom"
      round
      custom-style="height: 660rpx;"
      @close="closeShow"
  >
    <van-tabs swipeable color = '#0AD192'>
      <van-tab v-for="(item,index) in questionList3" :title="index+1">
        <scroll-view scroll-y style="width: 700rpx;height: 520rpx;background-color: #F6F8FC;padding: 20rpx">
          <view  style="min-height: 80rpx;font-size: 26rpx;color: #8a8a8a">
            {{item}}
          </view>
          <view style="display: flex;flex-wrap: wrap;gap: 30rpx;margin-top: 20rpx;padding: 10rpx 20rpx">
            <view v-for="(item,idx) in ss" @click="selected3(index,idx)" :class="{'select': idx.toString() == ans[3][index] }" style="width: 100rpx;height: 100rpx;border-radius: 50%;background-color: #fff;box-shadow: 0 0 10rpx rgba(0,0,0,0.1);text-align: center;line-height: 100rpx">{{item}}</view>

          </view>

        </scroll-view>

      </van-tab>
    </van-tabs>
    <!--    <van-icon name="arrow-down" />-->
  </van-popup>





  <view v-if="questionType == 4" style="height: calc(100vh - 285rpx);background-color: #F6F8FC">
    <scroll-view scroll-y :class="{'cont':!show}" style="height: 480rpx;">
      <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">
        {{questionList[4].content}}
      </view>

    </scroll-view>

  </view>
  <van-popup
      v-if="questionType == 4"
      closeable
      :overlay="false"
      :show="show"
      position="bottom"
      round
      custom-style="height: 660rpx;"
      @close="closeShow"
  >
    <van-tabs swipeable color = '#0AD192'>
      <van-tab v-for="(item,index) in questionList4" :title="index+1">
        <scroll-view scroll-y style="width: 700rpx;height: 520rpx;background-color: #F6F8FC;padding: 20rpx">
          <view style="min-height: 80rpx;font-size: 26rpx;color: #8a8a8a">
            {{item.title}}
          </view>
          <view v-for="(p,idx) in item.select" @click="selected4(index,idx)" :class="{'select': idx.toString() == ans[4][index] }" style="background-color: white;padding: 20rpx;margin: 35rpx 20rpx;border-radius: 10rpx;min-height: 60rpx;line-height: 80rpx">
            {{p}}
          </view>
        </scroll-view>

      </van-tab>
    </van-tabs>
    <!--    <van-icon name="arrow-down" />-->
  </van-popup>



  <view v-if="questionType == 5" style="height: calc(100vh - 285rpx);background-color: #F6F8FC">
    <scroll-view scroll-y :class="{'cont':!show}" style="height: 480rpx;">
      <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">
        {{questionList[5].content}}
      </view>

    </scroll-view>

  </view>
  <van-popup
      v-if="questionType == 5"
      closeable
      :overlay="false"
      :show="show"
      position="bottom"
      round
      custom-style="height: 660rpx;"
      @close="closeShow"
  >
    <van-tabs swipeable color = '#0AD192'>
      <van-tab v-for="(item,index) in questionList5" :title="index+1">
        <scroll-view scroll-y style="width: 700rpx;height: 520rpx;background-color: #F6F8FC;padding: 20rpx">
          <view style="min-height: 80rpx;font-size: 26rpx;color: #8a8a8a">
            {{item.title}}
          </view>
          <view v-for="(p,idx)  in item.select" @click="selected5(index,idx)" :class="{'select': idx.toString() == ans[5][index] }" style="background-color: white;padding: 20rpx;margin: 35rpx 20rpx;border-radius: 10rpx;min-height: 60rpx;line-height: 80rpx">
            {{p}}
          </view>
        </scroll-view>

      </van-tab>
    </van-tabs>
    <!--    <van-icon name="arrow-down" />-->
  </van-popup>


  <view v-show="questionCount==0 " style="height: calc(100vh - 285rpx);background-color: #f6f8fc">
    <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">{{questionList[0].content}}</view>
    <textarea maxlength="-1" v-model="ans[0]" style="height: 400rpx;border-radius: 10rpx;width: 700rpx;padding: 20rpx 10rpx;background-color: #f3f2f2;margin: 0 auto" placeholder="请输入内容"/>
  </view>

  <view v-show="questionCount==56 " style="height: calc(100vh - 285rpx);background-color: #f6f8fc">
    <view style="padding: 20rpx;background-color: #f6f8fc;font-size: 28rpx">{{questionList[6].content}}</view>
    <textarea maxlength="-1" v-model="ans[6]" style="height: 400rpx;border-radius: 10rpx;width: 700rpx;padding: 20rpx 10rpx;background-color: #f3f2f2;margin: 0 auto" placeholder="请输入内容"/>
  </view>



  <view style="z-index: -1;height: 100rpx;display: flex;align-items: center;justify-content: space-around" v-if="!show">
    <view style="display: flex;align-items: center;gap: 100rpx">
      <view @click="show = !show" >
        <van-icon name="records-o" size="55rpx"/>
        <view style="font-size: 22rpx;color: #3F536E;opacity: 0.6">选项</view>
      </view>
      <!--      <view>-->
      <!--        <van-icon name="completed-o" size="55rpx"/>-->
      <!--        <view style="font-size: 22rpx;color: #3F536E;opacity: 0.6">答题卡</view>-->
      <!--      </view>-->


    </view>

    <view style="display: flex;align-items: center;gap: 40rpx">
      <van-button  round hairline  color="#0AD192" @click="last" v-if="questionList.length > 1 && questionType > 0">上一题</van-button>
      <van-button round hairline color="#0AD192" @click="next" v-if="questionList.length > 1 && questionType < questionList.length">下一题</van-button>
<!--      <van-button round hairline color="#0AD192" @click="submission" > 交 卷 </van-button>-->
    </view>

  </view>


</template>

<style scoped>
.cont{
  height: calc(100vh - 285rpx) !important;
}
.select{
  background-color: #0AD192 !important;
  color: #fff;
}
.selecterror{
  background-color: #fb6d81 !important;
  color: #fff;
}
</style>
